/***********************************************************************
*	sample ucos ii 2416 probe
* author: qingluo
* date: april-22-2013
* version: v1.0
***********************************************************************/
#ifndef __OS_CPU_H__
#define __OS_CPU_H__
/*********************GLOBALS & EXTERNS****************************/
/**
#ifdef OS_CPU_GLOBALS
#define OS_EXT
#else
#define OS_EXT		extern
#endif
*/
/********************BASIC DATA TYPES**********************/
typedef unsigned char		BOOLEAN;
typedef unsigned char 		INT8U;
typedef signed char		INT8S;
typedef unsigned short		INT16U;
typedef signed short		INT16S;
typedef unsigned long		INT32U;
typedef signed long		INT32S;
typedef float				FP32;
typedef double			FP64;

typedef unsigned long		OS_STK;
typedef unsigned long		OS_CPU_SR;

/***************************CRITICAL*************************/
#define OS_CRITICAL_METHOD	3u
#if	OS_CRITICAL_METHOD == 3u
#define OS_ALLOC_SR()			OS_CPU_SR	cpu_sr = 0
#define OS_ENTER_CRITICAL()		{cpu_sr = OS_CPU_SR_Save();}
//#define OS_ENTER_CRITICAL()		{cpu_sr = OS_CPU_SR_Save();Uart_Printf("b %x\n", cpu_sr);}
#define OS_EXIT_CRITICAL()		{OS_CPU_SR_Restore(cpu_sr);}
#endif
/************************OS_STK GROWN DIRECTION********************/
#define OS_STK_GROWTH			1
#define OS_TASK_SW()			OSCtxSw()
/**********************FUNCTION PROTOTYPES*************************/
#if OS_CRITICAL_METHOD == 3
OS_CPU_SR OS_CPU_SR_Save(void);
void	OS_CPU_SR_Restore(OS_CPU_SR cpu_sr);
#endif

void OSCtxSw(void);
void OSIntCtxSw(void);
void OSStartHighRdy(void);
void OS_CPU_PendSVHandler(void);
void OS_CPU_SysTickHandler(void);
//void OS_CPU_SysTickInit(void);
INT32U OS_CPU_SysTickClkFreq(void);

#endif

